# Scrapy settings for weibo_spyder project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
#     https://docs.scrapy.org/en/latest/topics/settings.html
#     https://docs.scrapy.org/en/latest/topics/downloader-middleware.html
#     https://docs.scrapy.org/en/latest/topics/spider-middleware.html

BOT_NAME = 'weibo_spyder'

SPIDER_MODULES = ['weibo_spyder.spiders']
NEWSPIDER_MODULE = 'weibo_spyder.spiders'


# Crawl responsibly by identifying yourself (and your website) on the user-agent
# USER_AGENT = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1'

# Obey robots.txt rules
# ROBOTSTXT_OBEY = True

# Configure maximum concurrent requests performed by Scrapy (default: 16)
#CONCURRENT_REQUESTS = 32

# Configure a delay for requests for the same website (default: 0)
# See https://docs.scrapy.org/en/latest/topics/settings.html#download-delay
# See also autothrottle settings and docs
# 配置延迟，已在各个spider做个性配置
# DOWNLOAD_DELAY = 3
# RANDOMIZE_DOWNLOAD_DELAY = True
# The download delay setting will honor only one of:
#CONCURRENT_REQUESTS_PER_DOMAIN = 16
#CONCURRENT_REQUESTS_PER_IP = 16

# Disable cookies (enabled by default)
COOKIES_ENABLED = False

# Disable Telnet Console (enabled by default)
#TELNETCONSOLE_ENABLED = False

# Override the default request headers:
DEFAULT_REQUEST_HEADERS = {
  'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
  'Accept-Language': 'en',
  'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1',
  'cookie': '__bid_n=184b6f8a19fe40e6d54207; SUBP=0033WrSXqPxfM725Ws9jqgMF55529P9D9W5b5Dy-hsNZMDO7XhIWCyOo5JpX5K-hUgL.FoqXShMES0zNeh52dJLoIpUVdcif9EH8SC-41FHFBbH8SC-41FHFBntt; SCF=At4IZFqRlaNPbtiwZh_52DilzgxvehDE_YwBf8FXObNMpe9bbr_6RwM8D6LS3QcI3wiUXt7SpLR_2m1Oi8y1QCY.; SUB=_2A25O304yDeRhGeBK71UT9yzLyzyIHXVqIFJ6rDV6PUJbktAKLUb-kW1NR6wiljESfxZMrDTz0Z8_u20_Jjgzl8xv; _T_WM=39736771217; XSRF-TOKEN=845def; WEIBOCN_FROM=1110006030; MLOGIN=1; mweibo_short_token=1dc1986c67; BAIDU_SSP_lcr=https://cn.bing.com/; FPTOKEN=wt4yFeF8sVGa4J7Pni6b9FBiQvGjCbTyswPZs0NJEUQcEYoRaBSTgHtf7r/GJEs8Ln2cfngZQytltUKVc0ie0M2Iw5utHXkLZjnT9v0x6rqZSdaOxQEo58/+aDUTsrFUsNOh9G/ZYMiyXLRKHw4+2fob6vIE7dZ4m6AIIQSF9J7FyNwW4OYd9FGC+gs/rATW/uYhCyvlLUNzfJja6Gk7jH6lcJ6vaWI/hp43QgNZXsrQNY5g5A5KdSkqDEgp5w5TqW/hzPtwljtp3gPF1QaMAbb0Cy0q4CU4+S3oEA9Jx4CXxfywVNygwcBnTql4eiMTDCe2H8wf4jxl+GchM9bU9Ng9sSI2ktvK0eKyds7gD3eslh9Mpvkrvte1cU9HdnXuK3HN3alxlfDM3Y/oimoy0w==|mbmOoSaOZo3+veY/NA+mpoBHC4v/Uwj8UR3LkQ1gexY=|10|4f9960f8302e6a72f6e5f88039681f1b; M_WEIBOCN_PARAMS=oid%3D4881667536195266%26luicode%3D20000174%26uicode%3D20000174'
}

ITEM_PIPELINES = {
    'weibo_spyder.pipelines.WeiboSpyderPipeline': 300
}

# ElasticSearch config
ELASTICSEARCH_SERVER = '127.0.0.1'
ELASTICSEARCH_PORT = 9200
ELASTICSEARCH_USERNAME = 'elastic'
# ELASTICSEARCH_PASSWORD = 'elastic123'
# ELASTICSEARCH_INDEX = 'hot'
# ELASTICSEARCH_TYPE = 'HotItem'
# ELASTICSEARCH_UNIQ_KEY = 'url'

# ELASTICSEARCH_UNIQ_KEY = 'id'

# Enable or disable spider middlewares
# See https://docs.scrapy.org/en/latest/topics/spider-middleware.html
#SPIDER_MIDDLEWARES = {
#    'weibo_spyder.middlewares.WeiboSpyderSpiderMiddleware': 543,
#}

# Enable or disable downloader middlewares
# See https://docs.scrapy.org/en/latest/topics/downloader-middleware.html
#DOWNLOADER_MIDDLEWARES = {
#    'weibo_spyder.middlewares.WeiboSpyderDownloaderMiddleware': 543,
#}

# Enable or disable extensions
# See https://docs.scrapy.org/en/latest/topics/extensions.html
#EXTENSIONS = {
#    'scrapy.extensions.telnet.TelnetConsole': None,
#}

# Configure item pipelines
# See https://docs.scrapy.org/en/latest/topics/item-pipeline.html
#ITEM_PIPELINES = {
#    'weibo_spyder.pipelines.WeiboSpyderPipeline': 300,
#}

# Enable and configure the AutoThrottle extension (disabled by default)
# See https://docs.scrapy.org/en/latest/topics/autothrottle.html
#AUTOTHROTTLE_ENABLED = True
# The initial download delay
#AUTOTHROTTLE_START_DELAY = 5
# The maximum download delay to be set in case of high latencies
#AUTOTHROTTLE_MAX_DELAY = 60
# The average number of requests Scrapy should be sending in parallel to
# each remote server
#AUTOTHROTTLE_TARGET_CONCURRENCY = 1.0
# Enable showing throttling stats for every response received:
#AUTOTHROTTLE_DEBUG = False

# Enable and configure HTTP caching (disabled by default)
# See https://docs.scrapy.org/en/latest/topics/downloader-middleware.html#httpcache-middleware-settings
#HTTPCACHE_ENABLED = True
#HTTPCACHE_EXPIRATION_SECS = 0
#HTTPCACHE_DIR = 'httpcache'
#HTTPCACHE_IGNORE_HTTP_CODES = []
#HTTPCACHE_STORAGE = 'scrapy.extensions.httpcache.FilesystemCacheStorage'
